#ifndef LOGIN_H
#define LOGIN_H

#include <QWidget>
#include <QMouseEvent>
#include <QEvent>
#include <atomic>
#include <iostream>
#include "../define.h"
#include "control/contrl_logic.h"
#include "ui/mainwindow.h"

using namespace std;
namespace Ui {
class Login;
}

class Login : public QWidget
{
    Q_OBJECT

public:
    explicit Login(QWidget *parent = nullptr);
    ~Login();

protected:
    void mouseMoveEvent(QMouseEvent *event);
    void mousePressEvent(QMouseEvent *event);
private slots:
    void on_min_btn_clicked();

    void on_close_btn_clicked();

    void on_login_btn_clicked();

    void init();

    void checkPassword(const QString& name,const QString& pwd);
    void on_pwd_edit_returnPressed();

private:
    Ui::Login *ui;
    bool mouse_press = 1;
    QPoint move_point;
    QMap<QString,UserInfo> userInfo_;
    MainWindow *mainWindow_ = nullptr;
    UserInfo loginUserInfo_;
};

#endif // LOGIN_H
